let User = require("./User");
let gameDao = require("./../dao/gameDao");
let fishsever = require("./fishsever");
let schedule = require("node-schedule");
let log = require("./../../util/loginfo").getInstand;

var GameInfo = function () {

    var _gameinfo = "";

    var Game = function () {

        //初始化游戏
        this.init = function (_config, _fishConfig) {
            log.info('####init game!####');
            gameConfig = _config;
            this.serverId = gameConfig.serverId;
            this.setPool();
            //初始化用户列表
            this.userList = {};
            //比赛排行数据
            this.RankUserList = {};
            //在线人数为0
            this.onlinePlayerCount = 0;
            //统计
            this.winTotal = 0;
            this.lotteryCount = 0;
            this.hourWinTotal = 0;
            this.hourlotteryCount = 0;
            //维护模式
            this.maintain = false;
            this._io = {};
            this.GameList = new Array();
            this.matchRandKingList = [];

            this.fishsever = new fishsever(_fishConfig);

            let rule = new schedule.RecurrenceRule();
            let times = [];
            for (let i = 0; i < 60; i++) {
                times.push(i);
            }
            rule.second = times;
            let self = this;
            schedule.scheduleJob(rule, function () {
                let nowDate = new Date();
                let hours = nowDate.getHours();
                let minute = nowDate.getMinutes();
                let second = nowDate.getSeconds();
                //比赛时间 8:00 - 24:00
                if (minute % 20 == 0 && second == 0) {
                    //保存彩池
                    self.savePool();
                }

                //每个用户如果不发子弹，50秒，就让他自动离开
                for (let userItem in self.userList) {
                    if (self.userList[userItem].getTable() != -1) {
                        if (--self.userList[userItem]._shootTime == 0) {
                            self.userList[userItem]._socket.disconnect();
                            // log.info(userItem);
                        } else {
                            // log.info(self.userList[userItem]._shootTime);
                        }
                    }
                }

                if (gameConfig.maintain) {
                    --gameConfig.maintainTime;
                    log.info(gameConfig.maintainTime);
                    if (!gameConfig.maintainTime) {
                        self.savePool();
                        self.disconnectAllUser();
                    }
                }
            })
        };

        this.setIo = function (_io, _Csocket) {
            this.fishsever.setIo(_io, _Csocket);
            this._io = _io;
            this._Csocket = _Csocket;
        };

        this.Setmaintain = function (_flag) {
            this.maintain = _flag;
        };

        this.isMaintain = function () {
            return this.maintain;
        };

        //判断是否是同一scoket连续登录，不允许
        this.isLoginAgain = function (socket) {
            if (socket.userId) {
                return this.userList[socket.userId].Islogin();
            } else {
                return false;
            }
        };

        //添加用户
        this.addUser = function (_userInfo, socket) {
            log.info("添加");
            log.info(_userInfo);
            this.userList[_userInfo.userid] = new User(_userInfo, socket);
        };

        this.updateUser = function (userInfo) {
            log.info(userInfo._userId + "更新");
            log.info(userInfo);
            if (!this.userList[userInfo._userId]) return;

            //已经断线
            if (this.userList[userInfo._userId]._isLeave) {
                var result = {ResultCode: 0, userId: userInfo._userId};
                this._Csocket.emit("userDisconnect", result);
                delete this.userList[userInfo._userId];
                return;
            }


            log.info(userInfo._userId + "存在");
            this.userList[userInfo._userId].update(userInfo);

            this.LoginGame(userInfo._userId, this.serverId);
            ++this.onlinePlayerCount;

            //返回登陆信息
            var socketItem = this.userList[userInfo._userId]._socket;
            var resultObj = {
                account: this.userList[userInfo._userId]._account,
                id: this.userList[userInfo._userId]._userId,
                nickname: this.userList[userInfo._userId]._nickname,
                score: this.userList[userInfo._userId]._score,
                bet: gameConfig.gameBet
            };
            result = {resultid: '1', msg: 'login fishserver succeed!', Obj: resultObj};
            socketItem.emit('loginGameResult', result);

        };

        //获得在线人数
        this.getOnlinePlayerCount = function () {
            return this.onlinePlayerCount;
        };

        //在线所有人
        this.getOnlinePlayer = function () {
            return this.userList;
        };

        //用户结算
        this.balanceByUserId = function (_userId) {
            //log.info("用户结算")
            var useCoin = this.userList[_userId].getUseCoin();
            var winCoin = this.userList[_userId].getWinCoin();
            this.userList[_userId].balance();
            var info = {userid: _userId, useCoin: useCoin, winCoin: winCoin};
            //log.info(gameConfig.bulletActivity);
            gameDao.balanceLog(info, gameConfig.bulletActivity, gameConfig.everyWinCoinActivity, gameConfig.lvActivity, gameConfig.gameId, gameConfig.serverId, function (result) {
            })
            var CoinLog = [];
            var logTemp = {
                userId: _userId,
                useCoin: useCoin,
                winCoin: winCoin - useCoin,
                tax: 0,
                serverId: gameConfig.serverId,
                gameId: gameConfig.gameId
            }
            CoinLog.push(logTemp);
            this._Csocket.emit("insertMark", CoinLog);
        }


        //删除用户
        this.deleteUser = function (_socket) {
            if (_socket.userId && this.userList[_socket.userId]) {
                //如果用户没有座位ID才结算
                if (this.userList[_socket.userId].getSeat() >= 0) {
                    this.balanceByUserId(_socket.userId);
                }
                //用户离开,告诉同桌人
                var tableid = this.userList[_socket.userId].getTable();
                //发送信息给其他人

                var tablestring = "table" + tableid;
                _socket.broadcast.to(tablestring).emit('PlayerOut', {
                    PlayerSeatId: this.userList[_socket.userId].getSeat(),
                    userId: _socket.userId
                });
                //this.fishsever.io.sockets.in(tablestring).emit('PlayerOut', {PlayerSeatId:this.userList[_socket.userId].getSeat(),userId:_socket.userId});

                this._Csocket.emit("lineOut", {
                    signCode: gameConfig.LoginServeSign,
                    state: 0,
                    gameId: gameConfig.gameId,
                    serverId: gameConfig.serverId,
                    userId: _socket.userId,
                    tableId: -1,
                    seatId: -1
                });

                log.info("9用户离开!userid:" + this.userList[_socket.userId]._userId
                    + " Account:" + this.userList[_socket.userId]._account
                    + " score:" + this.userList[_socket.userId]._score);
                this.fishsever.LogoutRoom(this.userList[_socket.userId], _socket);
                delete this.userList[_socket.userId];

                --this.onlinePlayerCount;
                //log.info("10离线!同时在线:" + this.onlinePlayerCount + "人")
            }
        };

        //删除用户
        this.deleteUserById = function (_userId, msg) {
            if (_userId) {
                var socketItem = this.userList[_userId]._socket;
                result = {resultid: 0, msg: msg};
                socketItem.emit('loginGameResult', result);
                socketItem.userId = null;
                delete this.userList[_userId];
            }
        };

        //获得用户当前分数
        this.getUserscore = function (_userId) {
            if (_userId) {
                return this.userList[_userId]._score;
            }
        };

        //获得用户
        this.getUser = function (_userId) {
            if (_userId) {
                return this.userList[_userId];
            }
        };

        //用户是否在线
        this.IsPlayerOnline = function (_userId) {
            if (!_userId) {	//传输ID错误
                log.info("查询在线,参数错误");
                return -1;
            }
            if (this.userList[_userId]) {//未找到用户
                //log.info("查询在线,未找到" + _userId + "用户");
                return 1;
            } else {
                return 0;
            }
        };

        //获得用户当前分数
        this.getPlayerScore = function (_userId) {
            if (!_userId) {	//传输ID错误
                log.info("查询分数,参数错误");
                return -1;
            }
            if (this.userList[_userId]) {//未找到用户
                //log.info("查询在线,未找到" + _userId + "用户");
                return this.userList[_userId].getScore();
            } else {
                return -1;
            }
        };

        //GM加分
        this.addgold = function (_userId, score) {

            if (!_userId) {					//传输ID错误
                log.info("加分,未登录")
                return 0;
            }
            if (!this.userList[_userId]) {	//未找到用户
                log.info("加分,未登录")
                return 0
            } else {
                log.info(score)
                if (this.userList[_userId].addgold(score)) {
                    log.info(this.userList[_userId].getScore())
                    log.info("加分成功!")
                    var tablestring = "table" + this.userList[_userId].getTable();
                    this._io.sockets.in(tablestring).emit('addgoldResult', {
                        userId: _userId,
                        userSeatId: this.userList[_userId].getSeat(),
                        userScore: this.userList[_userId]._score
                    })
                    return 1;
                } else {
                    log.info("减分失败,大于用户分数!");
                    return 0;
                }
            }
        };


        //进入游戏
        this.LoginGame = function (_userId, gametype) {
            if (!this.userList[_userId]) return;
            //用户添加游戏ID
            //log.info(_userId)
            //log.info("用户进入游戏" + gametype);
            this.userList[_userId].loginGame(gametype);
        };

        this.addRankUserList = function (_info) {
            //log.info(_info);
            this.RankUserList[_info.userInfo.userId] = {
                id: _info.userInfo.userId,
                nickname: _info.userInfo._nickname,
                _score: gameConfig.roomApplyCoin
            };
        };


        //存储比赛成绩
        this.updateMatchRandKing = function (_userId, callback) {
            if (!this.userList[_userId]) {
                callback(0);
                return;
            }
            if (!this.userList[_userId]._Apply) {
                callback(0);
                return;
            }
            var userInfo = {};
            userInfo.matchId = this.userList[_userId]._matchId;
            userInfo.userId = _userId;
            userInfo.score = this.userList[_userId].getScore();
            userInfo.lastTime = this.userList[_userId]._lastTime;
            userInfo.roomType = gameConfig.serverId;

            this.matchRandKingList.push(userInfo);

            callback(1);
        };

        this.getFishList = function (_socket) {
            var _userId = _socket.userId;
            var fishList = [];
            if (!this.userList[_userId]) return fishList;
            if (this.userList[_userId].getTable() == -1) return fishList;
            fishList = this.fishsever.getFishCurrent(this.userList[_userId].getTable());
            _socket.emit("getFishListResult", {
                ResultCode: 0,
                msg: "",
                data: {fishList: fishList, SceneType: this.fishsever.getFishCurrentSceneType()}
            });
        };

        //进入房间
        this.LoginRoom = function (_userId, roomid, _socket) {
            if (!this.userList[_userId]) return;

            //进放房间失败
            //比赛时间低于30秒禁止进入房间
            if (!this.fishsever.MatchLogin && gameConfig.isMatchRoom) {
                _socket.emit("LoginRoomResult", {ResultCode: 0, msg: "比赛时间低于30秒禁止进入房间"})
                return;
            }

            if (!this.userList[_userId]._Apply && gameConfig.isMatchRoom) {
                _socket.emit("LoginRoomResult", {ResultCode: 0, msg: "未报名,无法进入"})
                return;
            }
            //如果没有进入游戏,无法进入任何房间
            if (this.userList[_userId].getGameId()) {

                if (this.userList[_userId].getSeat() == -1) {
                    this.userList[_userId].loginRoom(roomid);

                    //进入房间后，帮分配座位
                    var LoginResult = this.fishsever.LoginRoom(this.getUser(_userId), _socket, this.userList);
                    //log.info("用户进入房间" + roomid);

                    //如果是比赛房间,先拿数据库里的值*****


                    // LoginResult
                    //发送场景消息给当前用户
                    var tableUserList = Array();
                    for (var i = 0; i < this.fishsever.seatMax; i++) {
                        //除了自己以外
                        if (this.fishsever.tableList[LoginResult.tableId][i] && this.fishsever.tableList[LoginResult.tableId][i] != _userId) {
                            var userItem = {};
                            var userid = this.fishsever.tableList[LoginResult.tableId][i].userId;
                            //log.info(this.fishsever.tableList[LoginResult.tableId][i])
                            userItem.userId = this.userList[userid].getUserId();
                            userItem.seatId = this.userList[userid].getSeat();
                            userItem.nickname = this.userList[userid]._nickname;
                            userItem.score = this.userList[userid]._score;
                            userItem.diamond = this.userList[userid]._diamond;
                            userItem.userType = this.userList[userid]._Robot;
                            var url = 0;
                            if (this.userList[userid]._headimgurl) {
                                url =
                                    (this.userList[userid]._headimgurl);
                            }

                            userItem.headimgurl = url;
                            tableUserList.push(userItem);
                        }
                    }

                    var ResultData = {TableId: LoginResult.tableId, seatId: LoginResult.seatId, userList: tableUserList}
                    _socket.emit("LoginRoomResult", {ResultCode: 1, ResultData: ResultData});

                    var tablestring = "table" + LoginResult.tableId;
                    var url = 0;
                    if (this.userList[_userId]._headimgurl) {
                        url =
                            (this.userList[_userId]._headimgurl);
                    }
                    _socket.broadcast.to(tablestring).emit('playEnter', {
                        ResultCode: 1,
                        ResultData: {
                            UserId: _userId,
                            TableId: LoginResult.tableId,
                            seatId: LoginResult.seatId,
                            nickname: this.userList[_userId]._nickname,
                            score: this.userList[_userId]._score,
                            diamond: this.userList[_userId]._diamond,
                            headimgurl: url,
                            userType: this.userList[_userId]._Robot
                        }
                    });
                    //this.fishsever.io.sockets.in(tablestring).emit('playEnter', {ResultCode:1,ResultData:{UserId:_userId,TableId:LoginResult.tableId,seatId:LoginResult.seatId,nickname:this.userList[_userId]._nickname,score:this.userList[_userId]._score,headimgurl:url,userType:this.userList[_userId]._Robot}});

                    //把子弹时间初始化
                    this.userList[_userId].initShootTime();
                } else {
                    log.info("玩家" + _userId + "已经进入了房间");
                }
            } else
                log.info("用户" + _userId + ",没有进入任何游戏,进入房间")
        };

        //离开房间
        this.LogoutRoom = function (_socket) {
            if (!this.userList[_socket.userId]) {
                log.info("用户" + _socket.userId + "不存在");
                return;
            }
            //log.info("离开房间")
            if (this.userList[_socket.userId].getSeat() >= 0) {
                this.balanceByUserId(_socket.userId);
            }
            //用户离开,告诉同桌人
            var tableid = this.userList[_socket.userId].getTable();
            //发送信息给其他人

            var tablestring = "table" + tableid;
            _socket.broadcast.to(tablestring).emit('PlayerOut', {
                PlayerSeatId: this.userList[_socket.userId].getSeat(),
                userId: _socket.userId
            });
            //this.fishsever.io.sockets.in(tablestring).emit('PlayerOut', {PlayerSeatId:this.userList[_socket.userId].getSeat(),userId:_socket.userId});

            //移除桌子

            this.fishsever.LogoutRoom(this.userList[_socket.userId], _socket);
            this.userList[_socket.userId].LogoutRoom();
        };


        //中鱼
        this.fishHit = function (_userId, fishId, _bulletId, _sendId, hitInfo) {
            //log.info("fishHit");
            //判断是否是机器人
            if (_sendId) {
                if (this.userList[_sendId] && this.userList[_sendId]._Robot) {
                    _userId = _sendId;
                } else {
                    log.info("机器人已经离线");
                    return {code: -1};
                }
            }

            if (!_userId) {					//传输ID错误
                log.info("未传用户ID");
                return {code: -1};
            }
            if (!this.userList[_userId]) {	//未找到用户
                log.info("找不到用户");
                return {code: -1}
            }

            //log.info(this.userList[_userId].getSeat() + " - "+ this.fishsever.seatMax)
            if (this.userList[_userId].getSeat() >= 0 && this.userList[_userId].getSeat() < this.fishsever.seatMax) {
                //判断子弹是否存在
                var _bet = this.userList[_userId].removeBulletLife(_bulletId);
                if (_bet <= 0) {
                    //log.info("找不到子弹");
                    return {code: -1};
                }

                var hitResult = this.fishsever.fishHit(this.userList[_userId], _bet, 10, fishId, hitInfo);
                //log.info(hitResult.socre);
                this.userList[_userId].winscore(hitResult.socre * gameConfig.gameBet);
                if (hitResult.propId == 2) {
                    this.userList[_userId].winDiamond(hitResult.propValue);
                }
                //比赛分数
                if (gameConfig.isMatchRoom) {
                    this.RankUserList[_userId]._score = this.userList[_userId].getScore();
                }
                //hitResult.propId = 1;
                //hitResult.propCount = 1;
                //log.info(hitResult)
                this.userList[_userId].addProp(hitResult.propId, hitResult.propCount);
                //道具入库
                if (hitResult.propId != 2 && hitResult.propCount > 0) {
                    var info = {
                        userId: _userId,
                        proTypeId: hitResult.propId,
                        addProCount: hitResult.propCount,
                        roomid: gameConfig.serverId,
                        typeid: 3
                    };
                    //发送给游戏大厅
                    this._Csocket.emit("pro_change", info);
                }
                return hitResult.socre;
            } else {
                log.info("用户没有进入房间!");
                return 0;
            }
        };


        //炸弹中鱼
        this.boomFishHit = function (_userId, boomFishId, fishIdList, _sendId) {
            //log.info("fishHit");
            //判断是否是机器人
            if (_sendId && this.userList[_sendId] && this.userList[_sendId]._Robot) {
                _userId = _sendId;
            }

            if (!_userId) {					//传输ID错误
                log.info("未传用户ID")
                return {code: -1};
            }

            if (!this.userList[_userId]) {	//未找到用户
                log.info("找不到用户")
                return {code: -1}
            }
            ;

            var boom = this.fishsever.getBoomById(_userId, boomFishId)
            var boomLevel = 0;

            if (boom == null) {
                log.info("打不到炸弹")
                return {code: -1}
            }

            if (boom.type == 24) {
                boomLevel = 23
            } else {
                boomLevel = 5
            }


            var tablestring = "table" + this.userList[_userId].getTable();

            var outfishList = [];
            if (this.userList[_userId].getSeat() >= 0 && this.userList[_userId].getSeat() < this.fishsever.seatMax) {
                //判断子弹是否存在
                var score = 0;
                var idx = 0;
                for (var i = 0; i < 100 && fishIdList.length; ++i) {
                    // var idx = i % fishIdList.length;

                    var hitResult = this.fishsever.boomFishHit(this.userList[_userId], boom.bet, 10, fishIdList[idx], boomLevel);
                    this.userList[_userId].winscore(hitResult.socre * gameConfig.gameBet);
                    score += hitResult.socre;
                    //log.info(hitResult.socre);
                    if (hitResult.socre > 0) {
                        outfishList.push(fishIdList[idx]);
                        fishIdList.splice(idx, 1);
                        --idx;
                    }
                    ++idx;
                    if (idx >= fishIdList.length) {
                        idx = 0;
                    }

                }

                this._io.sockets.in(tablestring).emit('boomFishHitResult', {
                    ResultCode: 0,
                    ResultData: {userId: _userId, hitSocre: score, fishList: outfishList}
                });
                //log.info("总分:" + score);
                return score;
            } else {
                log.info("用户没有进入房间!")
                return 0;
            }
        }

        //发射子弹
        this.fishShoot = function (_socket, Info) {
            if (!_socket.userId) return;
            var tableid = this.userList[_socket.userId].getTable();
            if (tableid < 0) {
                log.info("error:没有进入桌子,发射子弹");
                return;
            }

            //子弹倍数是否可用

            if (!this.fishsever.findBulletBet(Info.bet)) {
                log.info("error:没有这个类型的子弹!");
                return;
            }

            //先扣钱,并保存子弹
            if (this.userList[_socket.userId].fishShoot(Info.bet, gameConfig.gameBet, Info.bulletId)) {
                //找到用户的桌子
                Info.score = this.userList[_socket.userId].getScore();
                //log.info(this.userList[_socket.userId]._Robot);
                //发送信息给其他人
                var tablestring = "table" + tableid;
                //log.info(tablestring)
                //_socket.broadcast.to(tablestring).emit('fishShoot', Info);
                this.fishsever.io.sockets.in(tablestring).emit('fishShoot', Info);
                if (!Info.isRobot) {
                    this.fishsever.changePool(Info.bet * gameConfig.gameBet);
                }
            }

        };

        this.getMatchRoom = function (_socket) {
            //制作排行榜
            if (gameConfig.isMatchRoom) {
                var randlist = [];
                for (userItem in this.RankUserList) {
                    randlist.push(this.RankUserList[userItem]);
                }
                randlist.sort(function (a, b) {
                    return b._score - a._score;
                })

                //只发前10
                randlist.splice(10, randlist.length - 10);
                var MatchTime = 0;
                var nowDate = new Date();
                var hours = nowDate.getHours();
                var minute = nowDate.getMinutes();
                var second = nowDate.getSeconds();
                if (hours >= 8) {
                    minute = 9 - (minute % 10);
                    second = 60 - second;
                    MatchTime = minute * 60 + second;
                }
                _socket.emit("matchRank", {time: MatchTime, list: randlist});
            }
        };

        this.getMoguiCount = function (_socket) {
            if (_socket.userId && this.userList[_socket.userId]) {
                var count = this.fishsever.getmoguiCount(_socket.userId);
                _socket.emit("getMoguiCountResult", {ResultCode: 0, count: count});
            } else {
                _socket.emit("getMoguiCountResult", {ResultCode: 1, msg: "未登录", count: 0});
            }

        };

        this.Setmaintain = function () {
            gameConfig.maintain = true;
        };

        this.disconnectAllUser = function () {
            for (var itme in this.userList) {
                this.userList[itme]._socket.disconnect();
            }
            log.info("服务器开启维护，已经全部离线");
        };

        this.savePool = function () {
            var pool = this.fishsever.getPool();
            pool.serverId = this.serverId;
            gameDao.UpdatePool(pool, function (Result) {
            })
        };

        this.setPool = function (info) {
            var self = this;
            gameDao.getPool(this.serverId, function (Result, row) {
                if (Result) {
                    self.fishsever.setPool(row[0]);
                }
            })

        };

        this.getDownTime = function (_socket) {
            if (!this.userList[_socket.userId]) {
                //log.info("用户" + _socket.userId + "不存在");
                return;
            }

            var tableid = this.userList[_socket.userId].TableId;
            if (tableid < 0) {
                _socket.emit("getDownTimeResult", {ResultCode: 0, msg: "用户没有进入桌子"});
                return;
            }

            var tableUserList = Array();
            for (var i = 0; i < this.fishsever.seatMax; i++) {
                //除了自己以外
                if (this.fishsever.tableList[tableid][i]) {// && this.fishsever.tableList[tableid][i].userId != _socket.userId){
                    //	log.info(this.fishsever.tableList[tableid][i])
                    //	log.info(_socket.userId)
                    var userItem = {};
                    var userid = this.fishsever.tableList[tableid][i].userId;
                    //log.info(this.fishsever.tableList[LoginResult.tableId][i])
                    userItem.userId = this.userList[userid].getUserId();
                    userItem.seatId = this.userList[userid].getSeat();
                    userItem.nickname = this.userList[userid]._nickname;
                    userItem.score = this.userList[userid]._score;
                    userItem.userType = this.userList[userid]._Robot;
                    var url = 0;
                    if (this.userList[userid]._headimgurl) {
                        url =
                            (this.userList[userid]._headimgurl);
                    }

                    userItem.headimgurl = url;
                    tableUserList.push(userItem);
                }
            }

            //每门下注额度
            _socket.emit("getDownTimeResult", {ResultCode: 1, tableUserList: tableUserList});
        };

        this.changePower = function (_socket, info) {
            if (_socket.userId && this.userList[_socket.userId]) {

                var tableid = this.userList[_socket.userId].getTable();
                var tablestring = "table" + tableid;
                this.fishsever.io.sockets.in(tablestring).emit('changePowerResult', info);
            }
        };


        this.useSkill = function (_socket, info) {
            if (_socket.userId && this.userList[_socket.userId]) {
                var _userId = _socket.userId;
                var cost = this.fishsever.costSkill(_socket.userId, info);

                if (cost > 0) {
                    var user = this.userList[_userId];
                    cost *= gameConfig.gameBet;
                    if (user.getScore() >= cost) {
                        this.userList[_userId].cost_score(cost);

                        var tableid = this.userList[_socket.userId].getTable();
                        var tablestring = "table" + tableid;
                        this.fishsever.io.sockets.in(tablestring).emit('useSkillResult', info);
                    }
                }
            }
        };

        this.fishHit_board = function (_socket, info) {
            if (_socket.userId && this.userList[_socket.userId]) {

                var tableid = this.userList[_socket.userId].getTable();
                var tablestring = "table" + tableid;
                this.fishsever.io.sockets.in(tablestring).emit('fishHit_boardResult', info);
            }
        }

        //运行初始化
        //this.init();
    };


    if (_gameinfo) {
        return {getInstand: _gameinfo}
    } else {
        log.info("####create game!####");
        _gameinfo = new Game();
        return {getInstand: _gameinfo}
    }

}();


module.exports = GameInfo;

